perm filename FMUNGE.REF[UP,DOC]9 blob sn#805255 filedate 1986-02-14 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00010 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002		FMUNGE is a hack for playing with fonts.  Its primary purpose is
C00006 00003	Reading and writing fonts:
C00009 00004	Using the Z, N, and M commands.
C00012 00005	Font tables and memory:
C00013 00006	Other miscellaneous commands:
C00015 00007	The format of star/dot files:
C00017 00008	W:23,0,20   A sample star/dot glyph (W from NGR25)
C00018 00009	The rest of the BNF:
C00021 00010	Caveat:
C00023 ENDMK
C⊗;
	FMUNGE is a hack for playing with fonts.  Its primary purpose is
to put characters into a text file where they can be edited with the
editor, ETV.  It can also perform, as we will describe, miscellaneous
other transformations on your fonts.
	The program, when started, begins by displaying a short list of
the available commands.  A star prompt requests a command.

The present version contains three added command sections, written by
A. L.Samuel.
	Command `Z' allows for the translation of .FNT files that were
designed for use at 200 pixels to the inch for the XGP printer into
versions that are suitable for use on the DOVER and ROVER printers at 384
pixels to the inch. The actual conversion ratio used was 2.0 instead of
1.92 and there are one less row and column. The net result is that fonts smaller
than 10 point will be sligtly reduced and fonts larger than 10 point will be
slightly enlarged. These dodges result in the production of more symmetrical
glyphs than could be produced using the 1.92 magnification factor.
	Command  `N' allows for the translation of .FNT files into versions
suitable for use with the IMAGEN printer at 300 pixels to the inch.
	Both command Z and command N adopt the expedient of producing a
dot-star file that can be edited with ET since the computer-produced
version may not always be completely satisfactory. The dot-star file can
then be read and used to produce an output file either in .FNT format or
transformed into .GF format by using command M as described below.
	Command `M' produces an output file in .GF format. Since .GF files
contain more information than that contained in .FNT files, an assumption
is made that the fonts are intended for use in only one size which is
taken to be a nominal 10 pt size.  Accordingly, the DOVER-intended files
should carry a .384 extension and the IMAGEN-intended files should carry a
.300 extension when stored on [gf,sys].

The program FNTPL has been brought uptodate so that it and PLtoTF may be
used to create a TFM file that also should be specified to be for 10
point. The use of these programs allows one to modify the old FNT fonts so
that they can be used with TeX.
Reading and writing fonts:
	The first class of commands (Get and Put) are used for reading
and writing a font (.FNT file) from memory.  The syntax and semantics are:

G{<table number>}<fontname>    	Read (get) the requested font into table
				<table number>.
P{<table number>}<fontname>    	Write (put) the font in table <table number>
				onto the file <fontname>.
I{<table number>}<fontname>	Read (input) the requested characters from 
				font file <fontname> into table <table number>.
				Unlike the G command, I doesn't erase the 
				previous characters already in that table.

	To transfer between the internal font format of FMUNGE, and editable
form, (henceforth "Star/Dot" format) the Read and Write commands are used:

R{table number>}<filename>	Read the requested characters from the star/dot
				file, into the font table.  The file must be
				a valid ETV format file.
W{table number>}<filename>	Write the requested characters from font <table
				number> onto the file <filename> in star/dot format.
				The file thus created is ready for ETV (complete
				with directory page).
T{table number>}          	Type the requested characters from font <table
				number> on your terminal in star/dot format.

The I, R, T, and W commands request a character set.  That is, they will
prompt you for the which of the characters are to be read or written.  A
null line (just a <return>) implies all characters in that file.

The R and W commands type the name of each character as they begin to
process it.  These commands (and the T command) may be interrupted by
typing <escape>I.
Using the Z, N, and M commands.
	The Z, N, and Z commands follow the conventions that are used for the
W command in that they allow one allow one either to request that certain
characters be transformed or, by typing a carriage return only, to request
that the complete file be transformed.  Each character (actually the
SAIL-modified-ascii equilavent) is printed on line as it is being
processed.

N{table number>}<filename>	Write the requested characters from font <table
				number> onto file <filename> in star/dot format
				suitably enlarged for use at 300 pixels per inch.
				The file thus created is ready for ETV (complete
				with directory page). The usual R command may
				then be used to read the star/dot file into
				memory in preparation for using the M command.

Z{table number>}<filename>	Write the requested characters from font <table
				number> onto file <filename> in star/dot format
				suitably enlarged for use at 384 pixels per inch.
				The file thus created is ready for ETV (complete
				with directory page). The usual R command may
				then be used to read the star/dot file into
				memory in preparation for using the M command.

M{table number>}<filename>	Write the requested characters from font <table
				number> onto the file <filename> in .GF format.
				Remember to type a carriage return only, if you
				want the entire font.
Font tables and memory:

	FMUNGE believes in the existence of three font tables, null, ',
and " (0, 1 & 2).  Thus, the command:

G'FIX25<cr>

reads FIX25.FNT[XGP,SYS] into table 1 (unless you have a FIX25.FNT on your
disk alias area.)
Other miscellaneous commands:

A<charname>←<charname>		Assignment command.  For instance, 
				Ak'←W"
				takes and makes the glyph of k in table one,
				the same as the glyph of W from table 2.

F{<table number>}		Change some of the font characteristics of that
				font (font height, message, height above baseline.)

D{<table number>}		Delete that font.

C				Character edit mode.  Permits you to change
				several of the characteristics of
				glyphs.  Currently, the options are
	D				Delete this character.
	K				Set the left kern of this character.
	W				Set this character's width.
				To exit either loop, give a null reply.

B				Call BAIL (if your version of FMUNGE has bail
				loaded.)  If you know what you're doing, there
				are useful things you can do from inside BAIL.

S				Save (or restore) the world.  The command
	S→<filename> 
				places on <filename> sufficient
				information so that the command
	S←<filename> 
				will restore computation to the state of the world
				when the save command was issued.

H, ?				Redisplay the help info.

E				Exit back to the monitor.

The format of star/dot files:

	The file must be an ETV format file.  FMUNGE uses the directory
to find the characters in the file.

	Each character has a page to itself.  The first line of the page
has the form:

<char>:<character width>,<left kern>,<height above baseline>    <comment>

	You can then skip some blank lines before the glyph definition.
The rest of the page defines the character.  The first non-blank line
determines the raster width of the character.  Periods, spaces are interpreted
as "undark" points; tabs are converted to a SINGLE space,
and all other printing characters are "dark" points.  Lines after the first
need not extend to the full width of the character (and characters beyond that
width are ignored).  The next page of this file is a sample star/dot glyph.

	If the height above the baseline is missing, or 0, then the
old height above the baseline is not changed.  Note that height above the
baseline is a font wide characteristic, and that the last height above
the baseline fmunge reads is the one that sticks.  Also note that characters
are read in ascii sequence, not file order.
W:23,0,20   A sample star/dot glyph (W from NGR25)

.......................
**.......***.......**..
**.......***.......**..
**.......***.......**..
**.......***.......**..
***.....*****.....***..
***.....**.**.....***..
.**.....**.**.....**...
.**.....**.**.....**...
.***...***.***...***...
.***...***.***...***...
..**...**...**...**....
..**...**...**...**....
..***.***...***.***....
..***.***...***.***....
...**.**.....**.**.....
...**.**.....**.**.....
...*****.....*****.....
....***.......***......
....***.......***......
.......................
The rest of the BNF:
	Items in braces are optional.  Items in brackets are descriptive.
* indicates 0 or more repetitions of that item.   Some spaces are ignored
on input; <return>, <altmode> and <formfeed> are delimiters.

<table number>  ::=    '  | "    [An absent table number indicates table 0.]
<fontname>      ::=  [Any legal SAIL file name.  Default extension = ".FNT".
		      If the operation is a read operation, then the font
		      will also be sought on [XGP,SYS].  FMUNGE will not
		      write on [XGP,SYS] unless you explicitly request it
		      (or are aliased to [XGP,SYS]). ]
<filename>      ::=  [Any legal file name.  Default extension for star/dot
		      files is ".CHR".]

<charlist>      ::=   <char>*    [A null <charlist> indicates every character.]

<charname>      ::=   <char>{<table number>}

<char>          ::=   [most of the characters on the keyboard] | #<ascii number>

<altmode>       ::=   [the altmode key]

<character width>::=  [a decimal number indicating the Logical width of this
		       character.]

<left kern>    ::=    [a decimal number indicating the left kern of this character.]

<baseline >    ::=    [a decimal number indicating the height above the baseline.]

A <return> as reply to a file name request aborts the request.  An altmode
in response to a character list request is likewise an abort.  If you fail
to supply some information, you will often be prompted for it.
Caveat:
	There are bound to be some more bugs in this program.  Complain if
you find any.  Use at your own risk.  As I stated originally, it's a hack.
I wrote it to do something for me; if it's useful for you, fine.
	There is lots more that could be added to this program.  I might eventually
get around to it.  I might not.  If there's something you especially want, I
might get around to it sooner.
	There are a few useful E macros for playing with fonts on EINIT.CMD[1,3].
If you write any more, let me know.

						Bob Filman

The original portion of this file has been used, not extensively but certainly
a fair amount, and is now pretty well tested. The same cannot be said for my
additions, so inspect your output carefully. 
						Art Samuel